<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="../templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            span {
                cursor:pointer;
            }

            span:hover {
                color:#FF9900;
            }
        </style>
    </ui:define>

    <ui:define name="content">
        <h1 class="title ui-widget-header ui-corner-all">Poll - Start/Stop</h1>
        <div class="entry">
            <p>Polling can be started and stopped manually on demand.</p>

            <h:form id="form">
                <p:commandButton type="button" value="Start" icon="ui-icon-play" onclick="PF('poll').start()" id="btnStart" />
                <p:commandButton type="button" value="Stop" icon="ui-icon-pause" onclick="PF('poll').stop()" id="btnStop" />

                <br /><br />

                <h:outputText id="txt_count" value="#{counterBean.count}" />

                <p:poll interval="4" listener="#{counterBean.increment}"
                        update="txt_count" widgetVar="poll" autoStart="false"/>
            </h:form>

            <h3>Source</h3>
            <p:tabView>
                <p:tab title="poll.xhtml">
                    <pre name="code" class="xml">
&lt;h:form id="form"&gt;

    &lt;p:commandButton type="button" value="Start"
            icon="ui-icon-play" onclick="PF('poll').start()" id="btnStart" /&gt;
    &lt;p:commandButton type="button" value="Stop"
            icon="ui-icon-pause" onclick="PF('poll').stop()" id="btnStop" /&gt;

    &lt;h:outputText id="txt_count" value="\#{counterBean.count}" /&gt;

    &lt;p:poll interval="4" listener="\#{counterBean.increment}"
            update="txt_count" widgetVar="poll" autoStart="false"/&gt;

&lt;/h:form&gt;
                    </pre>
                </p:tab>

                <p:tab title="CounterBean.java">
                    <pre name="code" class="java">
package org.primefaces.examples.view;

import java.io.Serializable;

import javax.faces.event.ActionEvent;

public class CounterBean implements Serializable{

	private int count;

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public void increment() {
		count++;
	}
}
                    </pre>
                </p:tab>
            </p:tabView>
        </div>

    </ui:define>
</ui:composition>